export interface ResponseType<T> {
   error: number
   msg: string
   data: T
}

export enum SchoolType {
   FREE,
   BASIC,
   ADVANCED
}

export interface SchoolSimpleInfo {
   id: number
   schoolId: string
   schoolName: string
   schoolType: SchoolType
   schoolLogoUrl: string
   hostServerUrl: string
   version: string
}

interface DecryptData {
   openId: string
   nickName: string
   gender: number
   language: string
   city: string
   province: string
   country: string
   avatauUrl: string
   unionId: string
}

export interface GetOpenIdAndUnionIdResult {
   openid: string
   sessionKey?: string
   unionid: string
   errCode: number
   errMsg?: string
   decryptData?: DecryptData
}

export interface LoginByWXInfoParam {
   AppID: string
   BrowserInfo: string
   LoginIP: string
   MacAddress: string
   MachineType: number
   Secret: string
   SysTemID: string
   encryptedData: string
   iv: string
   js_Code: string
}

export interface LoginByUserNameAndPasswordParam {
   AppID: string
   PSW: string
   SchoolID: string
   SysTemID: string
   UserID: string
   js_Code: string
}

export interface GetSubsystemBySystemId {
   schoolId: string
   systemId: string
}


export enum LoginResultState {
   SUCCESS,
   UNBIND,
   LOGIN_YUN_FAIL,
   LOGIN_WX_FAIL,
   LOGIN_ERROR_SCHOOL_ID,
   OTHER_FAIL
}

interface UserInfo {
   GroupName: string
   SubjectNames: string
   UserName: string
   manager: boolean
   student: boolean
   ShortName: string
   Token: string
   Gender: string
   SubjectIDs: string
   UserClass: number
   LockerState: string
   GroupID: string
   PhotoPath: string
   teacher: boolean
   GradeName: string
   UserID: string
   UpdateTime: string
   StudyLevel: string
   GradeID: string
   GlobalGrade: string
   Sign: string
   UserType: number
   SchoolID: string
   Psw: string
}

interface Wxsession {
   errcode: number
   unionid: string
   openid: string
   decryptData: DecryptData
   session_key: null
   errmsg: null
}

interface LoginSchoolInfo {
   SchoolTel: string
   CreateTime: string
   SchoolAddress: string
   SchoolName: string
   SchoolLevel: number
   SchoolYear: number
   CityName: string
   CountyID: string
   SchoolLogoUrl: string
   SchoolLinkman: string
   CountyName: string
   ProvinceName: string
   SchoolCode: string
   ProvinceID: string
   CityID: string
   HostServerUrl: string
   SchoolType: number
   SchoolID: string
   SchoolState: number
   Version: string
}

interface IdentityInfo {
   IconUrl: string
   IsPreset: boolean
   IdentityCode: string
   IdentityName: string
}

export interface LoginResult {
   state: LoginResultState
   msg: string
   wxsession: Wxsession
   moduleId: string
   userInfo: UserInfo
   schoolInfo: LoginSchoolInfo
   identityInfos: IdentityInfo[]
}

export interface SubsystemInfo {
   wsUrl: string
   url: string
}

export interface CheckTokenParam {
   appId: string
   schoolId: string
   schoolUrl: string
   systemId: string
   onTokenRefresh: (token: string) => void
}


export interface OnShowAppParams {
   //目前已经定义规范的参数
   skip?: "0" | "1" //是否无需登录直接跳转
   systemID?: string //跳转链接字节限制无法使用具体路径，使用系统ID判断，人工匹配识别
   systemId?: string //模板消息里写的是systemId
   path?: string //配合systemId一起使用，进入首页后通过缓存进行跳转
   lockSchoolId ?: string //{"lockSchoolId":"S-XHWLXX"}登录页锁定学校，并显示学校logo
}
